package com.oracle.Service;

import com.oracle.Service.impl.OrderItemService;
import com.oracle.dao.impl.OrderItemDao;
import com.oracle.pojo.Orderitem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class OrderItemServiceImpl implements OrderItemService {

    @Autowired
    private OrderItemDao orderItemDao;

    @Override
    public int deleteOrderItemByBid(Integer bid) {
        int code = orderItemDao.deleteOrderItemByBid(bid);
        if (code==200){
            return 200;
        }
        return 400;
    }

    @Override
    public List<Orderitem> findOrderItemByOid(Integer oid) {
        return orderItemDao.findOrderItemByOid(oid);
    }

    @Override
    public int addNewOrderItem(Integer oid, Integer bid, Integer num, BigDecimal bprice, BigDecimal total) {
        return orderItemDao.addNewOrderItem(oid, bid, num, bprice, total);
    }

    @Override
    public Orderitem findOrderItemByOiid(Integer oiid) {
        return orderItemDao.findOrderItemByOiid(oiid);
    }

    @Override
    public int deleteOrderItemByOid(Integer oid) {
        return orderItemDao.deleteOrderItemByOid(oid);
    }
}
